package model;

import java.util.TimerTask;

import model.service.ServiceConnection;

public class UpdateTask extends TimerTask{

	private Holder _holder;
	private ThreadHandler _handler;
	
	public UpdateTask(Holder holder, ThreadHandler Handler)  // handler
	{
		_holder = holder;
		_handler = Handler;
	}

	@Override
	public void run() 
	{
		//create a connection based on the existence or absence of a machine.		
		createConnection(_holder.getMachine() != null);
	}
	
	private void createConnection(boolean varsOrNot) // handler
	{
		new ServiceConnection(varsOrNot, _handler).execute(_holder.getID());
	}

}
